% -----------------------
% END-OF-PREAMBLE STUFF
% -----------------------

$if(epigraph)$
% -----------
% Epigraphs
% -----------
\usepackage{epigraph}
\renewcommand{\epigraphsize}{\sffamily\footnotesize}
\setlength{\epigraphrule}{0em}
\setlength{\beforeepigraphskip}{-2em}
\setlength{\afterepigraphskip}{1em}
$endif$

$if(biblatex)$
% ----------
% BibLaTeX
% ----------
$if(biblatex-chicago)$
\usepackage[$if(biblio-style)$$biblio-style$,$endif$$for(biblatexoptions)$$biblatexoptions$$sep$,$endfor$]{biblatex-chicago}
$else$
\usepackage[$if(biblio-style)$style=$biblio-style$,$endif$$for(biblatexoptions)$$biblatexoptions$$sep$,$endfor$]{biblatex}
$endif$

\setlength\bibitemsep{0pt}  % No space between bib entries
\renewcommand*{\bibfont}{\footnotesize}  % Use smaller font
\setlength\bibhang{\parindent}  % Match document indentation

% Fix biblatex's odd preference for using In: by default.
\renewbibmacro{in:}{%
  \ifentrytype{article}{}{%
  \printtext{\bibstring{}\intitlepunct}}}

\addbibresource{$bibliography$}
$endif$

% ---------------------- 
% Title block elements
% ---------------------- 
\usepackage{orcidlink}  % Create automatic ORCID icons/links

$if(title)$
\title{$title$$if(thanks)$\thanks{$thanks$}$endif$}
$endif$

$if(subtitle)$
\usepackage{etoolbox}
\makeatletter
\providecommand{\subtitle}[1]{% add subtitle to \maketitle
  \apptocmd{\@title}{\par {\vskip 0.25em \large #1 \par}}{}{}
}
\makeatother
\subtitle{$subtitle$}
$endif$

\author{
$for(by-author)$
{\large $it.name.literal$$if(it.orcid)$~\orcidlink{$it.orcid$}$endif$}%
$if(it.attributes.corresponding)$\thanks{Corresponding author.}$endif$ \\%
$for(it.affiliations)$$it.name$ \\$endfor$%
{\footnotesize \url{$it.email$}} \and
$endfor$
}

\date{}


% Typeset URLs in the same font as their parent environment
%
% This has to come at the end of the preamble, after any biblatex stuff because 
% some biblatex styles (like APA) define their own \urlstyle{}
\usepackage{url}
\urlstyle{same}

% ---------------------------
% END END-OF-PREAMBLE STUFF
% ---------------------------
